package behavioral.template_method;

/**
 * @ClassName: MainTest
 * @Description: 测试类
 * @Author: liu-hao
 * @Date: 2023-04-11 23:54
 * @Version: 1.0
 **/
public class MainTest {
    public static void main(String[] args) {
        // 加法器
        AbstractCalculator adder = new Adder();
        int result = adder.calculate("8+8", "\\+");
        System.out.println("8+8 = " + result);

        // 减法器
        AbstractCalculator subtractor = new Subtractor();
        int result2 = subtractor.calculate("10-6", "\\-");
        System.out.println("10-6 = " + result2);
    }
}
